//
//  AIAdressView.m
//  aixianfeng
//
//  Created by 李江波 on 2016/12/22.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

#import "AIAddressView.h"
#import <Masonry.h>
#import "AItrigonView.h"

@interface AIAddressView ()

@property(nonatomic ,strong) UILabel *addressLable;

@end

@implementation AIAddressView

-(instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    
    _addressLable = [[UILabel alloc] init];
    _addressLable.text = @"前所";
    _addressLable.font = [UIFont boldSystemFontOfSize:16];
    
    [self addSubview:_addressLable];
    [_addressLable sizeToFit];
    [_addressLable mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.equalTo(self);
        make.top.equalTo(self);
    }];
    
    UILabel *prefixName = [UILabel cz_labelWithText:@"配送至" fontSize:10 color:[UIColor blackColor]];
    prefixName.backgroundColor = [UIColor clearColor];
    prefixName.layer.borderWidth = 1;
    prefixName.layer.borderColor = [UIColor blackColor].CGColor;
    
    [self addSubview:prefixName];
    [prefixName sizeToFit];
    [prefixName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self);
        make.right.equalTo(_addressLable.mas_left).offset(-5);
        make.width.offset(40);
        make.height.offset(12);
    }];
    
    AItrigonView *trigonView = [[AItrigonView alloc]init];
    trigonView.backgroundColor = [UIColor clearColor];
    [self addSubview:trigonView];
    [trigonView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.width.offset(16);
        make.height.offset(12);
        make.left.equalTo(_addressLable.mas_right).offset(5);
        make.top.equalTo(self).offset(2);
    }];
    
}

-(void)setAddress:(NSString *)address{
    NSLog(@"2222");
    _address = address;
    _addressLable.text = address;
}

@end
